
Vue.component2('a_1_0_1_0_0', {  
    template: `
        <div class="a_1_0_1_0_0_menu_bar" :key="refresh">
            <div class="a_1_0_1_0_0_menu_item" v-for="(menu_id, index) in data.fast_menu"  @mouseover="showSubMenu(menu_id)" @mouseleave="hideSubMenu(menu_id)">
                {{ data.menus[menu_id].menu_name }}
                <div class="a_1_0_1_0_0_sub_menu" v-show="data.show_flag[menu_id]">
                    <div class="a_1_0_1_0_0_sub_menu_item" v-for="(item_id,index2) in data.menus[menu_id].item_fast" :key="menu_id+'_'+item_id" @click="handleClick(menu_id,item_id)">
                        {{ data.menus[menu_id].item_dct[item_id].item_name }}
                    </div>
                </div>
            </div>
        </div>
`,  
  data() {
      return {
        refresh:"1",/*用来刷新组件*/
        data:{
            //目录结构:
            /*
           menus: {
                'menu_id':{//目录id
                    "menu_name":"目录名称",
                    "menu_fast":"快捷键",
                    "item_fast":[],//快速搜索目录
                    "item_dct":{//目录中的选项
                        "item_id":{//选项id
                        "item_fast":"快捷键",
                            "item_name":"选项名称",
                            "callback":"选项回调函数"
                        }

                    }
                }
            },
            */
            menus: {

        },
        fast_menu:[],//存放menus ids的数组 ids被转为整数 按照sort顺序排列
        show_flag:{}
        }
         
      };
  },
  methods: {
      showSubMenu(menu_id) {
        console.log("showsub",true)
          this.data.menus[menu_id].showSubMenu = true;
          if (!this.data.show_flag[menu_id]){
            this.data.show_flag[menu_id]=this.data.menus[menu_id].item_fast_length &&this.data.menus[menu_id].showSubMenu;
            this.refresh=this.refresh=="2"?"1":"2";
          }
      },
      hideSubMenu(menu_id) {
          this.data.menus[menu_id].showSubMenu = false;
          this.refresh=this.refresh=="2"?"1":"2";
      },
      handleClick(menu_id,item_id) {
          alert(`当前点击${menu_id} ${item_id}`);
      },

  },
  mounted:function(){
    //调用此函数刷新整个组件
    _this.refresh_func=function(){
        //创建菜单目录 快速查找数组
        _this.data.fast_menu=(Object.keys(_this.data.menus).map(Number)).sort();
        //创建菜单目录的选项快速查找数组
        let menu_id=null;
        for (let i=0;i<_this.data.fast_menu.length;i++){
            menu_id=_this.data.fast_menu[i];
            _this.data.show_flag[menu_id]=false;
            _this.data.menus[menu_id].item_fast=(Object.keys(_this.data.menus[menu_id].item_dct).map(Number)).sort();
            _this.data.menus[menu_id].item_fast_length=_this.data.menus[menu_id].item_fast.length;
        }
        //更改key 从而刷新整个组件
        _this.refresh=_this.refresh=="2"?"1":"2";
        console.log("刷新:",_this.refresh);
    }

    
      //查看当前目录数据
      //设置选项
      _this.data.set_item=function(obj){
        /*
        menu_id:目录id
        item_id:选项id
        item_name:选项名称
        item_callback:选项回调
        item_keys:选项快捷方式  //后面需要
        */
        let menu_id=obj.menu_id;
        let item_id=obj.item_id;
        let item_name=obj.item_name;
        let item_callback=obj.item_callback;
        let item_keys=obj.item_keys;
       //如果已经那么仅修改名称
       if (!_this.data.menus.hasOwnProperty(menu_id)){
        //如果没有拥有这个目录 则新建一个
        _this.data.menus[menu_id]={
            "menu_name":'未命名目录',
            "menu_fast":'',
            "showSubMenu":false,
            "item_dct":{},//当前目录的选项
        }
       }
       //如果当前选项已经拥有  那么修改选项相关属性
       if(_this.data.menus[menu_id].item_dct.hasOwnProperty(item_id)){
        _this.data.menus[menu_id].item_dct[item_id].item_name=item_name;
        _this.data.menus[menu_id].item_dct[item_id].item_callback=item_callback;
        _this.data.menus[menu_id].item_dct[item_id].item_keys=item_keys;
       }else
       //如果当前选项没有拥有 那么新建这个选项
        {
            _this.data.menus[menu_id].item_dct[item_id]={
                'item_name':item_name,
                "item_callback":item_callback,
                "item_keys":item_keys
            }
        }
        _this.refresh_func();//刷新组件
      },
      //设置目录
      _this.data.set_menu=function(obj){
        /*
        menu_id:目录id
        menu_name:目录名称
        menu_keys:目录快捷方式
        */
       let menu_id=obj.menu_id;
       let menu_name=obj.menu_name;
       let menu_keys=obj.menu_keys;
       //如果已经拥有这个目录 那么仅修改名称
       if (_this.data.menus.hasOwnProperty(menu_id)){
        _this.data.menus[menu_id]['menu_name']=menu_name;
        _this.data.menus[menu_id]['menu_keys']=menu_keys;
       }else{
        //如果没有拥有则新建一个
        _this.data.menus[menu_id]={
            "menu_name":menu_name,
            "menu_keys":menu_keys,
            "showSubMenu":false,
            "item_dct":{},//当前目录的选项
        }
       }
       _this.refresh_func();//刷新组件
      },
      //绑定快捷方式对象
      _this.data.bind_fast_obj=function(fast_obj){
        /*快捷方式通过全局 快捷方式对象进行调用*/
      }
  }
} 
);



Vue.component2('a_1_0_1_1_0', {  
    template: `
        <div class="a_1_0_1_1_0_menu_bar" :key="refresh">

            <div class="a_1_0_1_1_0_activity_item" v-for="(menu_id, index) in data.fast_menu" :key="index" @click="selectActivity(menu_id)" :class="{ a_1_0_1_1_0_active: menu_id == selectedActivity }"@mouseover="showSubMenu(menu_id)" @mouseleave="hideSubMenu(menu_id)">
                <span :class="data.menus[menu_id].menu_class"></span>
                <div class="a_1_0_1_1_0_sub_menu" v-if="menu_id==show_menu">
                    <div class="a_1_0_1_1_0_menu_item">
                        {{data.menus[menu_id].menu_name}}
                    </div>
                </div>
            </div>
        </div>
`,  
  data() {
      return {
        show_menu:"-1",
        selectedActivity:'0',
        refresh:"1",/*用来刷新组件*/
        data:{
            
            //目录结构:
            /*
           menus: {
                'menu_id':{//目录id
                    "menu_name":"目录名称",
                    "menu_fast":"快捷键",
                    "item_fast":[],//快速搜索目录
                    "item_dct":{//目录中的选项
                        "item_id":{//选项id
                        "item_fast":"快捷键",
                            "item_name":"选项名称",
                            "callback":"选项回调函数"
                        }

                    }
                }
            },
            */
            menus: {

        },
        fast_menu:[],//存放menus ids的数组 ids被转为整数 按照sort顺序排列
        show_flag:{}
        }
         
      };
  },
  methods: {
    showSubMenu(menu_id) {
        if (this.show_menu!=menu_id){
            this.show_menu=menu_id;
            console.log(this.show_menu)
            this.refresh=this.refresh=="2"?"1":"2";
        }
    },
    hideSubMenu(menu_id) {
        this.show_menu=null;
        this.refresh=this.refresh=="2"?"1":"2";
    },
    selectActivity(id) {
        this.selectedActivity = id;
        console.log(`Selected activity: ${id}`);
    },

  },
  mounted:function(){
    //调用此函数刷新整个组件
    _this.refresh_func=function(){
        //创建菜单目录 快速查找数组
        _this.data.fast_menu=(Object.keys(_this.data.menus).map(Number)).sort();
        _this.refresh=_this.refresh=="2"?"1":"2";
    }

    
      //设置选项
      _this.data.set_menu=function(obj){
        /*
        menu_id:选项id
        menu_name:选项名称
        menu_class:选项类
        menu_keys:选项快捷方式
        */
       let menu_id=obj.menu_id;
       let menu_name=obj.menu_name;
       let menu_class=obj.menu_class;
       let menu_keys=obj.menu_keys;
       let callback=obj.callback;
       //如果已经拥有这个目录 那么仅修改名称
       if (_this.data.menus.hasOwnProperty(menu_id)){
        _this.data.menus[menu_id]['menu_name']=menu_name;
        _this.data.menus[menu_id]['menu_class']=menu_class;
        _this.data.menus[menu_id]['menu_keys']=menu_keys;
        _this.data.menus[menu_id]['callback']=callback;
       }else{
        //如果没有拥有则新建一个
        _this.data.menus[menu_id]={
            "menu_name":menu_name,
            "menu_keys":menu_keys,
            "menu_class":menu_class,
            "callback":callback,
        }
       }
       _this.refresh_func();//刷新组件
      },
      //绑定快捷方式对象
      _this.data.bind_fast_obj=function(fast_obj){
        /*快捷方式通过全局 快捷方式对象进行调用*/
      }
  }
} 
);



Vue.component2('a0_a1_a0_a0_a0', {  
    template: `
<div class="a0_a1_a0_a0_a0_div" key="refresh">
  <div v-for="value,indexr in data.control_all">
    <div class="a0_a1_a0_a0_a0_title">
      <div class="a0_a1_a0_a0_a0_item">{{value.groupname}}</div>
      <div class="a0_a1_a0_a0_a0_item a0_a1_a0_a0_a0_right">状态:{{value.status}}</div>
    </div>
    <div class="a0_a1_a0_a0_a0_title">
      <div v-for="v2,i2 in value.list" class="a0_a1_a0_a0_a0_item a0_a1_a0_a0_a0_center">
        <button class="a0_a1_a0_a0_a0_button">{{v2.opname}}</button>
      </div>
    </div>
  </div>
</div>
`,  
  data(){
    return {
      refresh:"1",
      data:{
        control_all_fast_dct:{
          '运行模式':0,
          '诱虫灯':1,
          '吹虫风机':2,
          '雨虫挡板':3,
          '杀虫仓上挡板':4,
          '杀虫仓加热':5,
          '杀虫仓下挡板':6,
          '烘干仓加热':7,
          '烘干仓下挡板':8,
          '震动装置':9,
          '补光灯':10,
          '摄像头':11,
          '清扫装置':12,

        },
        control_all:[
          {
            groupname:'运行模式',
            status: '加载中',
            list:[{'opname': '手动', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsRkFGQkZBMDAwMDAwRkE='}, 
              {'opname': '自动', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsRkFGQkZBMDAwMTAwRkE='}]
          },
          {
            groupname:'诱虫灯',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMTIwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMTIwMjAwMDY='}]
          },
          {
            groupname:'吹虫风机',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDIwMTAwMDY='}, 
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDIwMjAwMDY='}]
          },
          {
            groupname:'雨虫挡板',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDMwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDMwMjAwMDY='}]
          },
          {
            groupname:'杀虫仓上挡板',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDQwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDQwMjAwMDY='}]
          },
          {
            groupname:'杀虫仓加热',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDUwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDUwMjAwMDY='}]
          },
          {
            groupname:'杀虫仓下挡板',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDYwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDYwMjAwMDY='}]
          },
          {
            groupname:'烘干仓加热',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDcwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDcwMjAwMDY='}]
          },
          {
            groupname:'烘干仓下挡板',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDgwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDgwMjAwMDY='}]
          },
          {
            groupname:'震动装置',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDkwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDkwMjAwMDY='}]
          },
          {
            groupname:'补光灯',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDEwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDEwMjAwMDY='}]
          },
          {
            groupname:'摄像头',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDIwMTAwMDY='}]
          },
          {
            groupname:'清扫装置',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDMwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDMwMjAwMDY='}]
          },

        ],
          control_types:{'msg': '操作成功',
            'data': {'datetime': '2024-09-25 12:01:19', 'did': 'AAAA402A8FB24514', 'op': [
              {'groupname': '运行模式', 'status': '手动'}, 
              {'groupname': '诱虫灯', 'status': '关闭'},
              {'groupname': '吹虫风机', 'status': '关闭'},
              {'groupname': '雨虫挡板', 'status': '关闭'},
              {'groupname': '杀虫仓上挡板', 'status': '关闭'},
              {'groupname': '杀虫仓加热', 'status': '关闭'},
              {'groupname': '杀虫仓下挡板', 'status': '关闭'},
              {'groupname': '烘干仓加热', 'status': '关闭'},
              {'groupname': '烘干仓下挡板', 'status': '关闭'},
              {'groupname': '震动装置', 'status': '关闭'},
              {'groupname': '补光灯', 'status': '关闭'},
              {'groupname': '摄像头', 'status': '开启'},
              {'groupname': '清扫装置', 'status': '关闭'}]}, 'status': 1}
          
          ,
              
      }
    }

},
watch_bind:{
  // "___show":function(e){this.data.show_flag=true;this.bind_show_func(true)},
},
    methods: {
      refresh_dom:function(){
        if (this.refresh.length>10){this.refresh="1"}else{this.refresh=this.refresh+"1"}
      },
      /*更新设备状态*/ 
      update_control_all:function(control_types){
        let lst=control_types['data']['op'];
        for(let i=0;i<lst.length;i++){
          this.data.control_all[this.data.control_all_fast_dct[lst[i]['groupname']]]['status']=lst[i]['status']
        }
        this.refresh_dom()
      }
    },
    watch:{//监听输入框的变化
     },
    mounted: function () {  
      //测试
      this.update_control_all(this.data.control_types);
    }
        
    
} 
);




Vue.component2('a0_a1_a0_a1_a0', {  
    template: `
<div class="a0_a1_a0_a1_a0_div" key="refresh">

<div class="a0_a1_a0_a1_a0_title">
  <div class="a0_a1_a0_a1_a0_item">设备ID</div>
  <div class="a0_a1_a0_a1_a0_item a0_a1_a0_a1_a0_right">23142412</div>
</div>

<div class="a0_a1_a0_a1_a0_title">
  <div class="a0_a1_a0_a1_a0_item">工作状态</div>
  <div class="a0_a1_a0_a1_a0_item a0_a1_a0_a1_a0_right">已连接</div>
</div>

</div>
`,  
  data(){
    return {
      refresh:"1",
      data:{
        control_all_fast_dct:{
          '运行模式':0,
          '诱虫灯':1,
          '吹虫风机':2,
          '雨虫挡板':3,
          '杀虫仓上挡板':4,
          '杀虫仓加热':5,
          '杀虫仓下挡板':6,
          '烘干仓加热':7,
          '烘干仓下挡板':8,
          '震动装置':9,
          '补光灯':10,
          '摄像头':11,
          '清扫装置':12,

        },
        control_all:[
          {
            groupname:'运行模式',
            status: '加载中',
            list:[{'opname': '手动', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsRkFGQkZBMDAwMDAwRkE='}, 
              {'opname': '自动', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsRkFGQkZBMDAwMTAwRkE='}]
          },
          {
            groupname:'诱虫灯',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMTIwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMTIwMjAwMDY='}]
          },
          {
            groupname:'吹虫风机',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDIwMTAwMDY='}, 
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDIwMjAwMDY='}]
          },
          {
            groupname:'雨虫挡板',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDMwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDMwMjAwMDY='}]
          },
          {
            groupname:'杀虫仓上挡板',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDQwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDQwMjAwMDY='}]
          },
          {
            groupname:'杀虫仓加热',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDUwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDUwMjAwMDY='}]
          },
          {
            groupname:'杀虫仓下挡板',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDYwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDYwMjAwMDY='}]
          },
          {
            groupname:'烘干仓加热',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDcwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDcwMjAwMDY='}]
          },
          {
            groupname:'烘干仓下挡板',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDgwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDgwMjAwMDY='}]
          },
          {
            groupname:'震动装置',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDkwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwNzAwMDkwMjAwMDY='}]
          },
          {
            groupname:'补光灯',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDEwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDEwMjAwMDY='}]
          },
          {
            groupname:'摄像头',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDIwMTAwMDY='}]
          },
          {
            groupname:'清扫装置',
            status: '加载中',
            list:[{'opname': '开启', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDMwMTAwMDY='},
              {'opname': '关闭', 'cmd': 'M0j5A6yfN6D7A45cMcj9Ufx6MjAxMDUsMDEwODAwMDMwMjAwMDY='}]
          },

        ],
          control_types:{'msg': '操作成功',
            'data': {'datetime': '2024-09-25 12:01:19', 'did': 'AAAA402A8FB24514', 'op': [
              {'groupname': '运行模式', 'status': '手动'}, 
              {'groupname': '诱虫灯', 'status': '关闭'},
              {'groupname': '吹虫风机', 'status': '关闭'},
              {'groupname': '雨虫挡板', 'status': '关闭'},
              {'groupname': '杀虫仓上挡板', 'status': '关闭'},
              {'groupname': '杀虫仓加热', 'status': '关闭'},
              {'groupname': '杀虫仓下挡板', 'status': '关闭'},
              {'groupname': '烘干仓加热', 'status': '关闭'},
              {'groupname': '烘干仓下挡板', 'status': '关闭'},
              {'groupname': '震动装置', 'status': '关闭'},
              {'groupname': '补光灯', 'status': '关闭'},
              {'groupname': '摄像头', 'status': '开启'},
              {'groupname': '清扫装置', 'status': '关闭'}]}, 'status': 1}
          
          ,
              
      }
    }

},
watch_bind:{
  /* "___show":function(e){this.data.show_flag=true;this.bind_show_func(true)},*/
},
    methods: {
      refresh_dom:function(){
        if (this.refresh.length>10){this.refresh="1"}else{this.refresh=this.refresh+"1"}
      },
    },
    watch:{//监听输入框的变化
     },
    mounted: function () {  
    }
        
    
} 
);




Vue.component2('a0_a1_a0_a2_a0', {  
    template: `
<div class="a0_a1_a0_a2_a0_div" key="refresh">
  <div v-for="value,indexr in data.data">
    <div class="a0_a1_a0_a2_a0_title">
      <div class="a0_a1_a0_a2_a0_item">{{value.name}}</div>
      <div class="a0_a1_a0_a2_a0_item a0_a1_a0_a2_a0_right">{{value.value+value.unit}}</div>
    </div>
  </div>
</div>
`,  
  data(){
    return {
      refresh:"1",
      data:{
        data:[],
        device_types:{'msg': '操作成功', 
          'data': [
            {'datetime': '2024-09-25 12:01:16', 
              'jsonstr': '[{"unit":"℃","ename":"ins-Temp1","name":"杀虫仓温度","value":"21"},{"unit":"℃","ename":"ins-Temp2","name":"烘干仓温度","value":"22"},{"unit":"","ename":"ins-State","name":"降雨状态","value":"0"},{"unit":"Lux","ename":"ins-light","name":"光照度","value":"208"}]', 'did': 'AAAA402A8FB24514'}], 'status': 1}
              
      }
    }

},
watch_bind:{
  // "___show":function(e){this.data.show_flag=true;this.bind_show_func(true)},
},
    methods: {
      refresh_dom:function(){
        if (this.refresh.length>10){this.refresh="1"}else{this.refresh=this.refresh+"1"}
      },
      /*更新设备状态*/ 
      update_device_types:function(device_types){
        console.log(device_types['data'][0]['jsonstr'])
        let lst=JSON.parse(device_types['data'][0]['jsonstr']);
        this.data.data=[];
        for(let i=0;i<lst.length;i++){
          this.data.data.push({
            "unit":lst[i].unit,
            "name":lst[i].name,
            "value":lst[i].value
          })
          
        }
        this.refresh_dom()
      }
    },
    watch:{//监听输入框的变化
     },
    mounted: function () {  
      //测试
      this.update_device_types(this.data.device_types);
    }
        
    
} 
);




Vue.component2('a0_a1_a0_a3_a0', {  
    template: `
<div class="a0_a1_a0_a3_a0_div1">
<div class="a0_a1_a0_a3_a0_div" key="refresh">
  <div v-for="value,indexr in data.data">
    <div class="a0_a1_a0_a3_a0_title">
      <div class="a0_a1_a0_a3_a0_item">虫情警报</div>
      <div class="a0_a1_a0_a3_a0_item a0_a1_a0_a3_a0_right">{{value.datetime}}</div>
    </div>
    <div class="a0_a1_a0_a3_a0_title">
      <img class="a0_a1_a0_a3_a0_img"
      :src="value.thumb"
      width="610" height="511">
    </div>
  </div>
  </div>
  <div style="display:flex">
  <div>&#60</div>当前页码:{{page_num}}<div>&#62</div>
  </div>
</div>
`,  
  data(){
    return {
      page_num:"1",
      refresh:"1",
      data:{
        data:[],
        jpg_lst:{'msg': '操作成功', 'data': 
          [
            {'datetime': '2024-08-27 09:00:51', 'ai_result': '[]', 'ai_result_num': '[]', 
              'thumb': 'http://admin.wlwapp.cn/uploads/2024-08/4c61a9df1c11501719407615f95758f5.jpg',
               'ai_engine': '飞浆V21', 
               'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-08/e498410a9a242a26.jpg',
               'id': 31207.0, 'did': 'AAAA402A8FB24514', 'url': '2024-08', 'ai_status': 1.0},
            {'datetime': '2024-08-27 10:21:49', 'ai_result': '[]', 'ai_result_num': '[]', 
              'thumb': 'http://admin.wlwapp.cn/uploads/2024-08/a027717cbbae1cf3d3667e66866042ea.jpg', 'ai_engine': '飞浆V21', 
              'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-08/e952499b9a3c41d9.jpg', 'id': 31212.0, 'did': 'AAAA402A8FB24514', 'url': '2024-08', 'ai_status': 1.0}, 
              {'datetime': '2024-08-27 11:18:22', 'ai_result': '[]', 'ai_result_num': '[]', 
                'thumb': 'http://admin.wlwapp.cn/uploads/2024-08/ad752cd674afc598b1ad1028c0a30553.jpg', 'ai_engine': '飞浆V21', 
                'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-08/c4e14ab99b2fec59.jpg', 'id': 31222.0, 'did': 'AAAA402A8FB24514', 'url': '2024-08', 'ai_status': 1.0}, 
                {'datetime': '2024-08-27 12:30:15', 'ai_result': '[]', 'ai_result_num': '[]', 
              'thumb': 'http://admin.wlwapp.cn/uploads/2024-08/094221b995795f7e7d806ab7f4579fc0.jpg', 'ai_engine': '飞浆V21', 
              'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-08/f56c43549f0b647b.jpg', 'id': 31227.0, 'did': 'AAAA402A8FB24514', 'url': '2024-08', 'ai_status': 1.0}, {'datetime': '2024-09-07 21:09:49', 'ai_result': '[]', 'ai_result_num': '[]', 
                'thumb': 'http://admin.wlwapp.cn/uploads/2024-09/ecdd32658d2696144cabe4290bd9f00f.jpg', 'ai_engine': '飞浆V21', 
                'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-09/d4c64518a4edae2f.jpg', 'id': 31983.0, 'did': 'AAAA402A8FB24514', 'url': '2024-09', 'ai_status': 1.0}, {'datetime': '2024-09-07 21:10:28', 'ai_result': '[]', 'ai_result_num': '[]', 
                  'thumb': 'http://admin.wlwapp.cn/uploads/2024-09/2e22e20c275c504ded6e6106f4399614.jpg', 'ai_engine': '飞浆V21', 
                  'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-09/42d6458aac505de4.jpg', 'id': 31986.0, 'did': 'AAAA402A8FB24514', 'url': '2024-09', 'ai_status': 1.0}, {'datetime': '2024-09-07 22:22:55', 'ai_result': '[]', 'ai_result_num': '[]', 
                    'thumb': 'http://admin.wlwapp.cn/uploads/2024-09/d0a4fd1b08d6d25f8beb746221f50f3f.jpg', 'ai_engine': '飞浆V21', 
                    'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-09/302746848b0002fa.jpg', 'id': 32004.0, 'did': 'AAAA402A8FB24514', 'url': '2024-09', 'ai_status': 1.0}, {'datetime': '2024-09-07 22:23:39', 'ai_result': '[]', 'ai_result_num': '[]', 
                      'thumb': 'http://admin.wlwapp.cn/uploads/2024-09/f956074c0856764cafea429fb51b8a87.jpg', 'ai_engine': '飞浆V21', 
  'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-09/dc4c4f75b731b626.jpg', 'id': 32007.0, 'did': 'AAAA402A8FB24514', 'url': '2024-09', 'ai_status': 1.0}, {'datetime': '2024-09-07 23:35:50', 'ai_result': '[]', 'ai_result_num': '[]', 
    'thumb': 'http://admin.wlwapp.cn/uploads/2024-09/c1dade5bbc800837c7ca1ec169a4af16.jpg', 'ai_engine': '飞浆V21', 
    'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-09/106945aeb69e2c9f.jpg', 'id': 32018.0, 'did': 'AAAA402A8FB24514', 'url': '2024-09', 'ai_status': 1.0}, {'datetime': '2024-09-07 23:36:26', 'ai_result': '[]', 'ai_result_num': '[]', 
'thumb': 'http://admin.wlwapp.cn/uploads/2024-09/a71876fa6257e2b2651824f3df5fb02b.jpg', 'ai_engine': '飞浆V21', 
'source_thumb': 'http://admin.wlwapp.cn/uploads/2024-09/bd3749769c781b9b.jpg', 'id': 32021.0, 'did': 'AAAA402A8FB24514', 'url': '2024-09', 'ai_status': 1.0}], 'count': 101.0, 'status': 1}
          
      }
    }

},
watch_bind:{
  // "___show":function(e){this.data.show_flag=true;this.bind_show_func(true)},
},
    methods: {
      refresh_dom:function(){
        if (this.refresh.length>10){this.refresh="1"}else{this.refresh=this.refresh+"1"}
      },
      /*更新设备状态*/ 
      update_data:function(load_data){
        let lst=load_data['data'];
        this.data.data=[];
        for(let i=0;i<lst.length;i++){
          this.data.data.push({
            thumb:lst[i].thumb,
            source_thumb:lst[i].source_thumb,
            datetime:lst[i].datetime,
            ai_result:lst[i].ai_result,
            ai_result_num:lst[i].ai_result_num,
          })
          
        }
        this.refresh_dom()
      }
    },
    watch:{//监听输入框的变化
     },
    mounted: function () {  
      //测试
      this.update_data(this.data.jpg_lst);
    }
        
    
} 
);



